home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / programs.arc / D_CURVE.PRO next >
Text File  |  1986-10-07  |  802b  |  37 lines

  1. check_determ
  2. /* 
  3.   Dragon curve program from "LISP" Wenston & Horn. This is a graphocs
  4.   program and requires a CGA or EGA color card.  
  5. */
  6. database
  7.   root2(real)
  8.  
  9. predicates
  10.   dragon(real, integer, integer)
  11.   int_real(integer, real)
  12.  
  13. goal
  14.   R = sqrt(2.0),
  15.   assertz(root2(R)),
  16.   graphics(1,2,112), /* change attributes for clarity on your PC*/
  17.   penpos(4500, 18000, 180),
  18.   dragon(15000.0, 0, -1).
  19.  
  20. clauses
  21.   dragon(L, A, Sign) :-
  22.     L > 150.0,
  23.     root2(R),!,
  24.     L1 = L / R,
  25.     A1 = A + 45 * Sign, A2 = A - 45 * Sign,
  26.     !,dragon(L1, A1, 1),!,dragon(L1, A2, -1).
  27.   dragon(L, A, _) :-
  28.     penpos(X, Y, _),
  29.     penpos(X, Y, A),
  30.     random(CR), C=CR*7+1, int_real(Co,C),
  31.     pencolor(Co),   
  32.     int_real(Len, L),
  33.     forward(Len).
  34.  
  35.   int_real(I, R) :-
  36.      I=R.
  37.